//TERRAIN SCRIPT TEMPLATE

beginterrainscript; 

variables;

body;

beginstate INIT_STATE;
//called when this terrain script is first created in the game

break;

beginstate START_STATE;
break;

beginstate SEARCH_STATE;
//called when the party searches this terrain
	
break;

beginstate BLOCK_MOVE_STATE;
	if (my_loc_y() != 8) {
		if (char_loc_y(0) != my_loc_y() - 1 && char_loc_y(1) != my_loc_y() - 1 && char_loc_y(2) != my_loc_y() - 1 && char_loc_y(3) != my_loc_y() - 1) {
			set_terrain(my_loc_x(), my_loc_y(),0);
			set_terrain(my_loc_x(),my_loc_y() - 1,122);
			force_instant_terrain_redraw();
		}
	}
break;

beginstate STEP_INTO_SPOT_STATE;
//called when the party steps on this terrain
	if (terrain_in_this_spot() == 122) {
		if (my_loc_y != 27) {
		set_terrain(my_loc_x(), my_loc_y(),0);
		set_terrain(my_loc_x(),my_loc_y() + 1,122);
		force_instant_terrain_redraw();
		}
		if (my_loc_y() == 27) {
			set_flag(2,1,1);
			set_terrain(my_loc_x(),my_loc_y(),0);
			force_instant_terrain_redraw();
		}
	}
break;

beginstate UNLOCK_SPELL_STATE;
//called when the party casts Unlock Doors on this terrain
	
break;